import request from '@/utils/request'

// 查询资金拨款记录列表
export function listAllocation(query) {
  return request({
    url: '/funding/allocation/list',
    method: 'get',
    params: query
  })
}

// 查询资金拨款记录详细
export function getAllocation(allocationId) {
  return request({
    url: '/funding/allocation/' + allocationId,
    method: 'get'
  })
}

// 新增资金拨款记录
export function addAllocation(data) {
  return request({
    url: '/funding/allocation',
    method: 'post',
    data: data
  })
}

// 修改资金拨款记录
export function updateAllocation(data) {
  return request({
    url: '/funding/allocation',
    method: 'put',
    data: data
  })
}

// 删除资金拨款记录
export function delAllocation(allocationId) {
  return request({
    url: '/funding/allocation/' + allocationId,
    method: 'delete'
  })
}


/**
 * 查询资金拨款记录的历史记录
 * @param {Long} allocationId - 资金拨款记录ID
 * @returns {Promise} - 返回一个 Promise 对象
 */
export function getAllocationHistory(allocationId) {
  return request({
    url: '/funding/allocation/history/'+ allocationId, // 使用模板字符串
    method: 'get'
  });
}

// 回溯数据
export function restoreData(data) {
  return request({
    url: '/funding/allocation/restoreData',
    method: 'put',
    data: data
  })
}
